<template>
	<view class="detail" v-if="data">
		<view class="name"> {{data.sjyhj.yhjmc}}</view>
		<image class="img" :src="data.sjyhj.url"></image>
		<view class="date">有效期:{{data.sjyhj.kssj.slice(0,10)}}至{{data.sjyhj.jssj.slice(0,10)}}</view>
		<view v-if="data.hyyhj.zt === 1" class="date">使用时间:{{data.hyyhj.sysj}}</view>
		<view v-if="data.hyyhj.zt === 2" class="date">已过期</view>
		<view class="dec">使用说明:</view>
			<u-line></u-line>
		<view class="dec">{{data.sjyhj.yhjjs}}</view>
		<image v-if="data.hyyhj.zt === 0" class="back_user"  mode="widthFix"  :src="base64" ></image>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				base64:'',
				id: '',
				data: null
			}
		},
		onLoad(options) {
			this.id = options.id
			console.log(this.id)
			this.getById();
		},
		methods: {
			getById() {
				this.$http.post('/app/pay/getYhjXq', {
					id: this.id
				}).then(res => {
					console.log(res)
					this.base64 = 'data:image/png;base64,'  + res.data.base64
					this.data = res.data
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.detail {
		display: flex;
		flex-direction: column;
		align-items: center;

		.name {
			font-weight: bold;
			color: #000;
			font-size: 34rpx;
		}

		.img {
			margin: 30rpx;
			width: 300rpx;
			height: 300rpx;
		}

		.dec {}

		.date {
			margin: 30rpx;
		}
	}
</style>